import React from 'react'
import {render} from 'react-dom'
import App from './App'
import {ConfigProvider} from 'antd' //国际化语言配置
import zhCN from 'antd/es/locale/zh_CN';
import 'antd/dist/antd.less'
import {constantRoutes} from './routes'  //引入登录和404路由
import {BrowserRouter as Router,Switch,Route,Redirect} from 'react-router-dom'   //引入路由相关组件
import {Provider} from 'react-redux'   //组件与store连接
import store from './store/index'
render(
  <Provider store={store}>
      <Router>
       <ConfigProvider locale={zhCN}>
        <Switch>
          {
            constantRoutes.map(route => (
              <Route path={route.path} component={route.component} key={route.path} />
            ))
          }
          <Route path="/admin" component={App} />
          <Redirect to="/admin" from="/" exact />
          <Redirect to="/404" />
        </Switch>
       </ConfigProvider>
    </Router>
  </Provider>,
  document.getElementById('root')
)
